#ifndef Function_h_
#define Function_h_

#include    <defs.h>

/** Provides an abstract interface for a generic function.
 *
 *  Uses NVI (non-virtual interface) template. 
 */
class Function
{
public:
    /** Returns a sorted list of singularities of the function.
     *
     *  @param  from
     *          Beginning of the intreval.
     *  @param  to
     *          End of the interval.
     *  @param  singularities
     *          List of singularities on (from; to).
     */
    Status              GetSingularities
                            (
                            const Real&     from,
                            const Real&     to,
                            RealList&       singularities
                            );

    /** Returns the value of the function at the given point.
     *
     *  @param  x
     *          Argument.
     *  @param  y
     *          Value of the function.
     */
    Status              GetValue
                            (
                            const Real& x,
                            Real&       y
                            );

protected:
                        Function();
                        ~Function();

private:
    /** Returns a list of singularities of the function.
     */
    virtual Status      GetSingularitiesCore
                            (
                            const Real&     from,
                            const Real&     to,
                            RealList&       singularities
                            ) = 0;

    /** Returns the value of the function at the given point.
     */
    virtual Status      GetValueCore
                            (
                            const Real& x,
                            Real&       y
                            ) = 0;

};

#endif

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// eof
